package com.paises.dao.impl;

import com.paises.dao.PaisDao;
import com.paises.domain.Pais;
import java.util.Collection;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 *
 * @author mjcali
 */
@Repository
public class PaisDaoImpl implements PaisDao {

    @Autowired
    private SessionFactory sessionFactory;

    public void setSessionFactory(SessionFactory sessionFactoryMock){
        sessionFactory = sessionFactoryMock;
    }
    
    public Collection<Pais> buscarPaises() {
        Criteria criteria;
        criteria = sessionFactory.getCurrentSession().createCriteria(Pais.class);
        return (criteria.list());
    }
}
